import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = new VueRouter({
    routes: [{
            path: '/',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            redirect: 'Console',
            children: [{
                name: 'Console',
                path: '/Console',
                meta: {
                    title: "首页"
                },
                component: () =>
                    import ('../views/Home/Console.vue')
            }]
        }, {
            path: '/Producetion',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            meta: {
                title: "生产管理"
            },
            children: [{
                    name: 'ProductionPlan',
                    path: '/Producetion/ProductionPlan',
                    meta: {
                        title: "生产计划"
                    },
                    component: () =>
                        import ('../views/Production/ProductionPlan.vue')
                },
                {
                    name: 'ProcessDesign',
                    path: '/Producetion/ProcessDesign',
                    meta: {
                        title: "工序设计"
                    },
                    component: () =>
                        import ('../views/Production/ProcessDesign.vue')
                },
                {
                    name: 'Technology',
                    path: '/Producetion/Technology',
                    meta: {
                        title: "工艺流程"
                    },
                    component: () =>
                        import ('../views/Production/Technology.vue')
                },
                {
                    name: 'ProductionScheduling',
                    path: '/Producetion/ProductionScheduling',
                    meta: {
                        title: "生产排产"
                    },
                    component: () =>
                        import ('../views/Production/ProductionScheduling.vue')
                },
                {
                    name: 'ProductionReporting',
                    path: '/Producetion/ProductionReporting',
                    meta: {
                        title: "生产报工"
                    },
                    component: () =>
                        import ('../views/Production/ProductionReporting.vue')
                }
            ]
        }, {
            path: '/QualityManage',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            meta: {
                title: "质量管理"
            },
            children: [{
                    name: 'Defect',
                    path: '/QualityManage/Defect',
                    meta: {
                        title: "常见缺陷"
                    },
                    component: () =>
                        import ('../views/QualityManage/Defect.vue')
                },
                {
                    name: 'DetectionSettings',
                    path: '/QualityManage/DetectionSettings',
                    meta: {
                        title: "检测项设置"
                    },
                    component: () =>
                        import ('../views/QualityManage/DetectionSettings.vue')
                },
                {
                    name: 'DetectionTemplate',
                    path: '/QualityManage/DetectionTemplate',
                    meta: {
                        title: "检测模板"
                    },
                    component: () =>
                        import ('../views/QualityManage/DetectionTemplate.vue')
                },
                {
                    name: 'Incoming',
                    path: '/QualityManage/Incoming',
                    meta: {
                        title: "来料检验"
                    },
                    component: () =>
                        import ('../views/QualityManage/Incoming.vue')
                },
                {
                    name: 'Process',
                    path: '/QualityManage/Process',
                    meta: {
                        title: "过程检验"
                    },
                    component: () =>
                        import ('../views/QualityManage/Process.vue')
                },
                {
                    name: 'Shipping',
                    path: '/QualityManage/Shipping',
                    meta: {
                        title: "出货检验"
                    },
                    component: () =>
                        import ('../views/QualityManage/Shipping.vue')
                }
            ]
        }, {
            path: '/Equipment',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            meta: {
                title: "设备管理"
            },
            children: [{
                    name: 'DeviceType',
                    path: '/Equipment/DeviceType',
                    meta: {
                        title: "设备类型设置"
                    },
                    component: () =>
                        import ('../views/Equipment/DeviceType.vue')
                },
                {
                    name: 'Equipmentledger',
                    path: '/Equipment/Equipmentledger',
                    meta: {
                        title: "设备台账"
                    },
                    component: () =>
                        import ('../views/Equipment/Equipmentledger.vue')
                },
                {
                    name: 'InspectionItems',
                    path: '/Equipment/InspectionItems',
                    meta: {
                        title: "点检保养项目"
                    },
                    component: () =>
                        import ('../views/Equipment/InspectionItems.vue')
                },
                {
                    name: 'InspectionPlan',
                    path: '/Equipment/InspectionPlan',
                    meta: {
                        title: "点检保养计划"
                    },
                    component: () =>
                        import ('../views/Equipment/InspectionPlan.vue')
                },
                {
                    name: 'RepairOrder',
                    path: '/Equipment/RepairOrder',
                    meta: {
                        title: "维修单"
                    },
                    component: () =>
                        import ('../views/Equipment/RepairOrder.vue')
                }
            ]
        },
        {
            path: '/MasterData',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            meta: {
                title: "主数据"
            },
            children: [{
                    name: 'CodingRules',
                    path: '/MasterData/CodingRules',
                    meta: {
                        title: "编码规则"
                    },
                    component: () =>
                        import ('../views/MasterData/CodingRules.vue')
                },
                {
                    name: 'MaterialProductsManage',
                    path: '/MasterData/MaterialProductsManage',
                    meta: {
                        title: "物料产品管理"
                    },
                    component: () =>
                        import ('../views/MasterData/MaterialProductsManage.vue')
                },
                {
                    name: 'MaterialsProductClassify',
                    path: '/MasterData/MaterialsProductClassify',
                    meta: {
                        title: "物料产品分类"
                    },
                    component: () =>
                        import ('../views/MasterData/MaterialsProductClassify.vue')
                },
                {
                    name: 'MeasurementUnit',
                    path: '/MasterData/MeasurementUnit',
                    meta: {
                        title: "计量单位"
                    },
                    component: () =>
                        import ('../views/MasterData/MeasurementUnit.vue')
                },
                {
                    name: 'CustomerManage',
                    path: '/MasterData/CustomerManage',
                    meta: {
                        title: "客户管理"
                    },
                    component: () =>
                        import ('../views/MasterData/CustomerManage.vue')
                },
                {
                    name: 'SupplierManage',
                    path: '/MasterData/SupplierManage',
                    meta: {
                        title: "供应商管理"
                    },
                    component: () =>
                        import ('../views/MasterData/SupplierManage.vue')
                },
                {
                    name: 'WorkshopSet',
                    path: '/MasterData/WorkshopSet',
                    meta: {
                        title: "车间设置"
                    },
                    component: () =>
                        import ('../views/MasterData/WorkshopSet.vue')
                },
                {
                    name: 'Workstation',
                    path: '/MasterData/Workstation',
                    meta: {
                        title: "工作站"
                    },
                    component: () =>
                        import ('../views/MasterData/Workstation.vue')
                }
            ]
        }, {
            path: '/Organizational',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            meta: {
                title: "组织架构"
            },
            children: [{
                    name: 'DepartmentManage',
                    path: '/Organizational/DepartmentManage',
                    meta: {
                        title: "部门管理"
                    },
                    component: () =>
                        import ('../views/Organizational/DepartmentManage.vue')
                },
                {
                    name: 'PostManage',
                    path: '/Organizational/PostManage',
                    meta: {
                        title: "岗位管理"
                    },
                    component: () =>
                        import ('../views/Organizational/PostManage.vue')
                },
                {
                    name: 'RoleManage',
                    path: '/Organizational/RoleManage',
                    meta: {
                        title: "角色管理"
                    },
                    component: () =>
                        import ('../views/Organizational/RoleManage.vue')
                },
                {
                    name: 'UserManage',
                    path: '/Organizational/UserManage',
                    meta: {
                        title: "用户管理"
                    },
                    component: () =>
                        import ('../views/Organizational/UserManage.vue')
                }
            ]
        },
        {
            path: '/MoldManage',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            meta: {
                title: "模具管理"
            },
            children: [{
                    name: 'TypeSet',
                    path: '/MoldManage/TypeSet',
                    meta: {
                        title: "类型设置"
                    },
                    component: () =>
                        import ('../views/MoldManage/TypeSet.vue')
                },
                {
                    name: 'FixtureLedger',
                    path: '/MoldManage/FixtureLedger',
                    meta: {
                        title: "工装夹具台账"
                    },
                    component: () =>
                        import ('../views/MoldManage/FixtureLedger.vue')
                }
            ]
        },
        {
            path: '/Inventory',
            component: () =>
                import ('../views/Layout/Layout.vue'),
            meta: {
                title: "库存管理"
            },
            children: [{
                    name: 'WarehouseSettings',
                    path: '/Inventory/WarehouseSettings',
                    meta: {
                        title: "仓库设置"
                    },
                    component: () =>
                        import ('../views/Inventory/WarehouseSettings.vue')
                },

                {
                    name: 'Reservoir',
                    path: '/Inventory/Reservoir',
                    meta: {
                        title: "库区设置"
                    },
                    component: () =>
                        import ('../views/Inventory/Reservoir.vue')
                },
                {
                    name: 'WarehouseInventory',
                    path: '/Inventory/WarehouseInventory',
                    meta: {
                        title: "仓库现有量"
                    },
                    component: () =>
                        import ('../views/Inventory/WarehouseInventory.vue')
                },
                {
                    name: 'PurchaseReceipt',
                    path: '/Inventory/PurchaseReceipt',
                    meta: {
                        title: "采购入库"
                    },
                    component: () =>
                        import ('../views/Inventory/PurchaseReceipt.vue')
                },
                {
                    name: 'SupplierReturn',
                    path: '/Inventory/SupplierReturn',
                    meta: {
                        title: "供应商退货"
                    },
                    component: () =>
                        import ('../views/Inventory/SupplierReturn.vue')
                },
                {
                    name: 'ProductionMaterialRequisition',
                    path: '/Inventory/ProductionMaterialRequisition',
                    meta: {
                        title: "生产领料"
                    },
                    component: () =>
                        import ('../views/Inventory/ProductionMaterialRequisition.vue')
                },
                {
                    name: 'ProductionReturn',
                    path: '/Inventory/ProductionReturn',
                    meta: {
                        title: "生产退料"
                    },
                    component: () =>
                        import ('../views/Inventory/ProductionReturn.vue')
                },
                {
                    name: 'ProductStorage',
                    path: '/Inventory/ProductStorage',
                    meta: {
                        title: "产品入库"
                    },
                    component: () =>
                        import ('../views/Inventory/ProductStorage.vue')
                },
                {
                    name: 'SalesOutbound',
                    path: '/Inventory/SalesOutbound',
                    meta: {
                        title: "销售出库"
                    },
                    component: () =>
                        import ('../views/Inventory/SalesOutbound.vue')
                },
                {
                    name: 'SalesReturn',
                    path: '/Inventory/SalesReturn',
                    meta: {
                        title: "销售退货"
                    },
                    component: () =>
                        import ('../views/Inventory/SalesReturn.vue')
                },
                {
                    name: 'Transfertransfer',
                    path: '/Inventory/Transfertransfer',
                    meta: {
                        title: "转移调拨"
                    },
                    component: () =>
                        import ('../views/Inventory/Transfertransfer.vue')
                },
                {
                    name: 'CodeAssignmentManagement',
                    path: '/Inventory/CodeAssignmentManagement',
                    meta: {
                        title: "赋码管理"
                    },
                    component: () =>
                        import ('../views/Inventory/CodeAssignmentManagement.vue')
                },
                {
                    name: 'PackingManagement',
                    path: '/Inventory/PackingManagement',
                    meta: {
                        title: "装箱管理"
                    },
                    component: () =>
                        import ('../views/Inventory/PackingManagement.vue')
                },
                {
                    name: 'SNCode',
                    path: '/Inventory/SNCode',
                    meta: {
                        title: "SN码"
                    },
                    component: () =>
                        import ('../views/Inventory/SNCode.vue')
                },
            ]
        }
    ]
})

const routerRePush = VueRouter.prototype.push;
VueRouter.prototype.push = function(location) {
    return routerRePush.call(this, location).catch(error => error)
}

export default routes;